KFCurveNode Class Reference

#include <kfcurvenode.h>

List of all members.


Detailed Description

This class provides the structure to build a curve node hierarchy.

It is a composite class that contains curve node tree management services in itself. Cyclic graphs are forbidden in a curve node hierarchy.

The content of a curve node is in its function curve, which is an instance of class KFCurve. A function curve can't be shared among curve nodes.

Definition at line 359 of file kfcurvenode.h.


Constructors and Destructor

  KFCurveNode (char *pNodeName, char *pTimeWarpName, HKDataType pDataType, int pLayerType=KFCL_NOLAYER, int pLayerID=0)
  Constructor.
  KFCurveNode (HKFCurveNode pTemplateCurveNode)
  Template constructor.
virtual  ~KFCurveNode ()
  Destructor.

FCurve Creation

void  CreateFCurve ()
  Create the FCurve for this node.
bool  FCurveCreated ()
  Test to know if the FCurve is created.

Cloning and Copy Functions

HKFCurveNode  Clone (bool pKeepAttached)
  Return a duplicate of this node.
HKFCurveNode  CloneTemplate (bool pKeepAttached=false, bool pCloneFCurves=false, bool pCreateCurves=false, int pLayerID=-1)
  Return a duplicate of this node.
void  CopyFrom (HKFCurveNode pSource, bool pTransferCurve=false)
  Copy the function curve contained in the given curve node.
HKFCurveNode  Copy (KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE)
  Create a copy of the current curve node.

Node Identification

char *  GetName () const
  Retrieve the node's name.
char *  GetTimeWarpName () const
  Retrieve the node's time warp name.
char *  GetTypeName () const
  Retrieve the node type name.

Function Curve Management

HKFCurve  FCurveGet () const
  Get pointer to the node's function curve.
KFCurve FCurveSet (KFCurve *pCurve, bool pDestroyOldCurve=false)
  Set the function curve of this curve node.
void  FCurveReplace (KFCurve *pCurve)
  Replace the function curve of this curve node.
bool  GetTransformCurves (KFCurve *pT[3], KFCurve *pR[3], KFCurve *pS[3])
  Return translation, rotation and scaling curves of the children of this curve node.

Curve Node Management

virtual void  Clear ()
  Clear this node.
virtual int  Add (HKFCurveNode pCurveNode)
  Add a child curve node to this node.
virtual void  Remove (int pIndex)
  Remove a child curve node by index.
virtual void  Delete (int pIndex)
  Remove and delete a child curve node by index.
virtual int  GetCount () const
  Get children curve nodes count.
virtual HKFCurveNode  Get (int pIndex) const
  Get pointer to child curve node by index.
virtual bool  IsChild (KFCurveNode *pCurveNode, bool pRecursive=false) const
  Ask if a given curve node is a child of the current curve node.
virtual int  Find (char *pName) const
  Get index of child curve node by name.
virtual int  Find (HKFCurveNode pNode) const
  Get index of child curve node by pointer.
HKFCurveNode  FindRecursive (char *pName) const
  Recursively find the first child curve node by name.
HKFCurveNode  FindOrCreate (char *pName, bool pFindOrCreateCurve=true)
  Find a child node by name or create it if it can not be found.
virtual void  SetParent (HKFCurveNode pParent)
  Set the parent curve node.
virtual HKFCurveNode  GetParent () const
  Get the parent curve node.

Key Management

int  KeyGetCount (bool pRecursiveInLayers=false) const
  Get the number of animation keys.
void  KeyGetCount (int &pCurveCount, int &pTotalCount, int &pMinCount, int &pMaxCount) const
  Get the number of animation keys.
void  GetCurveWithFirstKey (KFCurve *&lCurveWithFirstKey, bool *pCurveMask, bool pRecursiveInLayers) const
  Get the fcurve that has the earliest key.
void  GetCurveWithLastKey (KFCurve *&lCurveWithLastKey, bool *pCurveMask, bool pRecursiveInLayers) const
  Get the fcurve that has the latest key.
KTime  GetFirstKeyTime (bool *pCurveMask=NULL, bool pRecursiveInLayers=false) const
  Get the first key time in the children specified by the curve mask (NULL = all children) If there is no key, return KTIME_MINUS_INFINITE.
KTime  GetLastKeyTime (bool *pCurveMask=NULL, bool pRecursiveInLayers=false) const
  Get the last key time in the children specified by the curve mask (NULL = all children) If there is no key, return KTIME_INFINITE.
double KeyAdd (KTime pTime, double *pValue)
  Recursively add a set of keys in the curve node tree.
double KeyAppend (KTime pTime, double *pValue, bool pCheckForContinuousRotation=false)
  Recursively append a set of keys in the curve node tree.
bool  GetAnimationInterval (KTime &pStart, KTime &pStop) const
  Find out start and stop time of the animation for a curve node and recursively in its children.
void  GetTimeSpan (KTime &pStart, KTime &pStop) const
  Find out start and stop time of the animation for a curve node and recursively in it's children.
int  IsKey (KTime &pTime, int *pLast, bool *pCurveMask=NULL, double pKeyIndexTolerance=0.0, double pMin=-K_DOUBLE_MAX, double pMax=K_DOUBLE_MAX) const
  Recursively check if keys exist at a given time in the curve node tree.
bool  DeleteKey (KTime &pTime, bool *pCurveMask=NULL, double pKeyIndexTolerance=0.0)
  Recursively delete keys at a given time in the curve node tree.
KTime  GetNextKeyTime (KTime pTime, bool *pCurveMask=NULL, bool pRecursiveInLayers=false) const
  Recursively find the closest later time at which a key can be found compared to a given time.
KTime  GetPrevKeyTime (KTime pTime, bool *pCurveMask=NULL) const
  Recursively find the closest earlier time at which a key can be found compared to a given time.
double Evaluate (double *pValue, KTime pTime, kFCurveIndex *pLast=NULL)
  Recursively evaluate the curve node tree.
double GetValue (double *pValue) const
  Recursively get the default values of the curve node tree.
double SetValue (double *pValue)
  Recursively set the default values of the curve node tree.
void  Delete (KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE)
  Delete all the keys found within a given time range.
void  Replace (HKFCurveNode pSource, KTime pStart=KTIME_MINUS_INFINITE, KTime pStop=KTIME_INFINITE, bool pUseGivenSpan=false, bool pKeyStartEndOnNoKey=true, KTime pTimeSpanOffset=KTIME_ZERO)
  Replace all the keys found within a given time range.

Constructor & Destructor Documentation

KFCurveNode ( char *  pNodeName,
char *  pTimeWarpName,
HKDataType  pDataType,
int  pLayerType = KFCL_NOLAYER,
int  pLayerID = 0  
)

Constructor.

Parameters:
pNodeName  Curve node name.
pTimeWarpName  Curve node.
pDataType  Curve node type.
pLayerType  LayerType.
pLayerID  LayerID.
Remarks:
No function curve is created in the new curve node.

KFCurveNode ( HKFCurveNode  pTemplateCurveNode  ) 

Template constructor.

Parameters:
pTemplateCurveNode  Template curve node.
Remarks:
This is not a copy constructor. This constructor makes the created curve node share a structure that defines the node name, node display name and node type name. No function curve is created or copied in the new curve node.

virtual ~KFCurveNode (  )  [virtual]

Destructor.


Member Function Documentation

void CreateFCurve (  ) 

Create the FCurve for this node.

This function is called recursively for all children curve nodes.

bool FCurveCreated (  ) 

Test to know if the FCurve is created.

This function is called recursively for all children curve nodes. It returns false as soon as one child does not have its FCurve.

HKFCurveNode Clone ( bool  pKeepAttached  ) 

Return a duplicate of this node.

This function is called recursively for all children curve nodes. The function curve is copied in the new curve node.

Parameters:
pKeepAttached  If true, the created object will share a structure that defines the node name, node display name and node type name. Otherwise, this structure is copied.
Remarks:
This function is equal to a call to KFCurveNode::CloneTemplate() with parameter pCloneFCurves set to true.
Returns:
A partial or complete copy of the current object.

HKFCurveNode CloneTemplate ( bool  pKeepAttached = false,
bool  pCloneFCurves = false,
bool  pCreateCurves = false,
int  pLayerID = -1  
)

Return a duplicate of this node.

This function is called recursively for all children curve nodes.

Parameters:
pKeepAttached  If true, the created object will share a structure that defines the node name, node display name and node type name. Otherwise, this structure is copied.
pCloneFCurves  If true and the current curve node has a function curve, the function curve is copied in the new curve node.
pCreateCurves  If true, pCloneFCurve is set to false and the current curve node has a function curve, an empty function curve is created in the new curve node.
pLayerID  LayerID.
Returns:
A partial or complete copy of the current object.

void CopyFrom ( HKFCurveNode  pSource,
bool  pTransferCurve = false  
)

Copy the function curve contained in the given curve node.

Parameters:
pSource  Given curve node to copy the function curve from.
pTransferCurve  If true, curve data is transferred instead of being copied.
Remarks:
This function is called recursively. The first child curve node of pSource is copied in the first child curve node of the current object and so on.

HKFCurveNode Copy ( KTime  pStart = KTIME_MINUS_INFINITE,
KTime  pStop = KTIME_INFINITE  
)

Create a copy of the current curve node.

The structure defining the node name, node display name and node type name is copied, not shared. Only the animation keys in a given time range are copied.

Parameters:
pStart  Start time for range of animation keys copied.
pStop  Stop time for range of animation keys copied.
Returns:
A partial or complete copy of the current object.

char* GetName (  )  const

Retrieve the node's name.

char* GetTimeWarpName (  )  const

Retrieve the node's time warp name.

char* GetTypeName (  )  const

Retrieve the node type name.

HKFCurve FCurveGet (  )  const

Get pointer to the node's function curve.

Returns:
Pointer to the curve or NULL pointer if there's none.

KFCurve* FCurveSet ( KFCurve pCurve,
bool  pDestroyOldCurve = false  
)

Set the function curve of this curve node.

Parameters:
pCurve  New function curve.
pDestroyOldCurve  Set to true to delete the function curve already contained in the curve node.
Returns:
Function curve previously contained in the curve node if there was any and if parameter pDestroyOldCurve is set to false. Otherwise, NULL is returned.

void FCurveReplace ( KFCurve pCurve  ) 

Replace the function curve of this curve node.

Previous function curve is automatically destroyed.

Parameters:
pCurve  New function curve.
Remarks:
This function is equal to a call to KFCurveNode::FCurveSet() with parameter pDestroyOldCurve set to true.

bool GetTransformCurves ( KFCurve pT[3],
KFCurve pR[3],
KFCurve pS[3]  
)

Return translation, rotation and scaling curves of the children of this curve node.

This function is meant to be called on the root KFCurveNode object found in class KFbxTakeNode.

Parameters:
pT  Array to receive X, Y and Z translation function curves.
pR  Array to receive X, Y and Z rotation function curves.
pS  Array to receive X, Y and Z scaling function curves.
Returns:
true if all function curves have been found, false otherwise.

virtual void Clear (  )  [virtual]

Clear this node.

Delete the function curve and all the children curve nodes.

virtual int Add ( HKFCurveNode  pCurveNode  )  [virtual]

Add a child curve node to this node.

Parameters:
pCurveNode  The child curve node to be added.
Returns:
The index of the new child curve node.

virtual void Remove ( int  pIndex  )  [virtual]

Remove a child curve node by index.

Parameters:
pIndex  Index of child curve node to be removed.

virtual void Delete ( int  pIndex  )  [virtual]

Remove and delete a child curve node by index.

Parameters:
pIndex  Index of child curve node to be deleted.

virtual int GetCount (  )  const [virtual]

Get children curve nodes count.

virtual HKFCurveNode Get ( int  pIndex  )  const [virtual]

Get pointer to child curve node by index.

Parameters:
pIndex  Index of child curve node.
Returns:
Pointer to child curve node or NULL is index is out of bounds.

virtual bool IsChild ( KFCurveNode pCurveNode,
bool  pRecursive = false  
) const [virtual]

Ask if a given curve node is a child of the current curve node.

Parameters:
pCurveNode  Curve node searched.
pRecursive  Set to true to search recursively. Set to false to search only in the immediate children curve nodes.
Returns:
true if the curve node searched is found, false otherwise.

virtual int Find ( char *  pName  )  const [virtual]

Get index of child curve node by name.

Parameters:
pName  Name of searched child curve node.
Returns:
Index or -1 if a child curve node with this name could not be found.
Remarks:
This function is not recursive.

virtual int Find ( HKFCurveNode  pNode  )  const [virtual]

Get index of child curve node by pointer.

Parameters:
pNode  Pointer to searched child curve node.
Returns:
Index or -1 if a child curve node with this pointer could not be found.
Remarks:
This function is not recursive.

HKFCurveNode FindRecursive ( char *  pName  )  const

Recursively find the first child curve node by name.

Parameters:
pName  Name of searched child curve node.
Returns:
Pointer to child curve node or NULL if this name could not be found.

HKFCurveNode FindOrCreate ( char *  pName,
bool  pFindOrCreateCurve = true  
)

Find a child node by name or create it if it can not be found.

Parameters:
pName  Name of child node to find.
pFindOrCreateCurve  If true and the function curve does not exist, create one in the curve node found or created.
Remarks:
This function is not recursive.

virtual void SetParent ( HKFCurveNode  pParent  )  [inline, virtual]

Set the parent curve node.

Parameters:
pParent  The parent curve node to be set.

Definition at line 613 of file kfcurvenode.h.

virtual HKFCurveNode GetParent (  )  const [inline, virtual]

Get the parent curve node.

Returns:
Pointer to the parent curve node or NULL if there is none.

Definition at line 618 of file kfcurvenode.h.

int KeyGetCount ( bool  pRecursiveInLayers = false  )  const

Get the number of animation keys.

Parameters:
pRecursiveInLayers  Return the total number of keys contained in the function curves included in the current node and its children curve nodes.

void KeyGetCount ( int pCurveCount,
int pTotalCount,
int pMinCount,
int pMaxCount  
) const

Get the number of animation keys.

Parameters:
pCurveCount  returns the number of fcurves held by this node
pTotalCount  returns the number of keys on all the fcurves held by this node
pMinCount  returns the minimum number of keys on an fcurve held by this node
pMaxCount  returns the maximum number of keys on an fcurve held by this node

void GetCurveWithFirstKey ( KFCurve *&  lCurveWithFirstKey,
bool *  pCurveMask,
bool  pRecursiveInLayers  
) const

Get the fcurve that has the earliest key.

If many fcurves has a key at the earliest time, returns one of the fcurves.

Parameters:
lCurveWithFirstKey  The fcurve has the earliest key.
pCurveMask  Allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 

void GetCurveWithLastKey ( KFCurve *&  lCurveWithLastKey,
bool *  pCurveMask,
bool  pRecursiveInLayers  
) const

Get the fcurve that has the latest key.

If many fcurves has a key at the latest time, returns one of the fcurves.

Parameters:
lCurveWithLastKey  The fcurve has last key.
pCurveMask  Allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 

KTime GetFirstKeyTime ( bool *  pCurveMask = NULL,
bool  pRecursiveInLayers = false  
) const

Get the first key time in the children specified by the curve mask (NULL = all children) If there is no key, return KTIME_MINUS_INFINITE.

Parameters:
pCurveMask  Allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 
Returns:
The first key time.

KTime GetLastKeyTime ( bool *  pCurveMask = NULL,
bool  pRecursiveInLayers = false  
) const

Get the last key time in the children specified by the curve mask (NULL = all children) If there is no key, return KTIME_INFINITE.

Parameters:
pCurveMask  Allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 
Returns:
The last key time.

double* KeyAdd ( KTime  pTime,
double pValue  
)

Recursively add a set of keys in the curve node tree.

Depth first key adding in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Time to add the keys.
pValue  Array containing all the key values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameter pValue added with an offset equal to the number of affected function curves times sizeof(kDouble).

double* KeyAppend ( KTime  pTime,
double pValue,
bool  pCheckForContinuousRotation = false  
)

Recursively append a set of keys in the curve node tree.

Depth first key appending in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Time set in the appended keys. Make sure this time has a greater value than any of the last keys in the affected function curves.
pValue  Array containing all the key values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
pCheckForContinuousRotation  Flag, when set to true we will check for continuous rotation values. This is like an unroll filter on the fly. Relevant only for rotation fcurve nodes.
Returns:
Value of parameter pValue added with an offset equal to the number of function curves affected times sizeof(kDouble).

bool GetAnimationInterval ( KTime pStart,
KTime pStop  
) const

Find out start and stop time of the animation for a curve node and recursively in its children.

Parameters:
pStart  Reference to store start time. pStart is overwritten only if the start time found is lower than pStart value. Initialize to KTIME_INFINITE to make sure the start time is overwritten in any case.
pStop  Reference to store end time. pStop is overwritten only if the stop time found is higher than pStop value. Initialize to KTIME_MINUS_INFINITE to make sure the stop time is overwritten in any case.
Returns:
true if at least one key has been found in all the function curves scanned.

void GetTimeSpan ( KTime pStart,
KTime pStop  
) const

Find out start and stop time of the animation for a curve node and recursively in it's children.

Parameters:
pStart  Reference to receive the smaller key time, set to KTIME_INFINITE if no key could be found.
pStop  Reference to receive the larger key time, set to KTIME_MINUS_INFINITE if no key could be found.

int IsKey ( KTime pTime,
int pLast,
bool *  pCurveMask = NULL,
double  pKeyIndexTolerance = 0.0,
double  pMin = -K_DOUBLE_MAX,
double  pMax = K_DOUBLE_MAX  
) const

Recursively check if keys exist at a given time in the curve node tree.

Check if a key exists at the given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Given time to check key occurrence.
pLast  Function curve index to speed up search. If this function is called in a loop, initialize this value to 0 and let it be updated by each call.
pCurveMask  allows you to use only specific children in the CurveNode. NULL means all of them.
pKeyIndexTolerance  allows the test to be less strict when matching the time with a key index.
pMin  Minimal Value to Consider the Key.
pMax  Maximal Value to Consider the Key.
Returns:
ISKEY_NONE if no function curve has a key at the given time, ISKEY_SOME if some function curves have a key at the given time or ISKEY_ALL if all function curves have a key at the given time.

bool DeleteKey ( KTime pTime,
bool *  pCurveMask = NULL,
double  pKeyIndexTolerance = 0.0  
)

Recursively delete keys at a given time in the curve node tree.

Delete keys at the given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Given time to delete keys.
pCurveMask  allows you to use only specific children in the CurveNode. NULL means all of them.
pKeyIndexTolerance  allows to be less strict when matching the time with a key index.
Returns:
true if at least one key has been found at the given time and deleted.

KTime GetNextKeyTime ( KTime  pTime,
bool *  pCurveMask = NULL,
bool  pRecursiveInLayers = false  
) const

Recursively find the closest later time at which a key can be found compared to a given time.

Find the closest but later time at which a key can be found compared to a given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Given time to search the next key time.
pCurveMask  allows you to use only specific children in the CurveNode. NULL means all of them.
pRecursiveInLayers 
Returns:
Next key time or KTIME_INFINITE if there exists no key with a time larger than the given time.

KTime GetPrevKeyTime ( KTime  pTime,
bool *  pCurveMask = NULL  
) const

Recursively find the closest earlier time at which a key can be found compared to a given time.

Find the closest earlier time at which a key can be found compared to a given time in the function curves included in the current node and its children curve nodes.

Parameters:
pTime  Given time to search the previous key time.
pCurveMask  allows you to use only specific children in the CurveNode. NULL means all of them.
Returns:
Previous key time or KTIME_MINUS_INFINITE if there exists no key with a time smaller than the given time.

double* Evaluate ( double pValue,
KTime  pTime,
kFCurveIndex pLast = NULL  
)

Recursively evaluate the curve node tree.

Depth first evaluation of the function curves included in the current node and its children curve nodes.

Parameters:
pValue  Array to receive all the function curve evaluations. This array must be long enough to contain as many elements as the number of function curves included in the current node and its children curve nodes.
pTime  Time of evaluation.
pLast  Function curve index to speed up evaluation. If this function is called in a loop, initialize this value to 0 and let it be updated by each call.
Returns:
Value of parameter pValue added with an offset equal to the number of function curves evaluated times sizeof(double).

double* GetValue ( double pValue  )  const

Recursively get the default values of the curve node tree.

Depth first access to the default values of the function curves included in the current node and its children curve nodes.

Parameters:
pValue  Array to receive all the function curve default values. This array must be long enough to contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameter pValue added with an offset equal to the number of function curves accessed times sizeof(double).

double* SetValue ( double pValue  ) 

Recursively set the default values of the curve node tree.

Depth first setting of the default values of the function curves included in the current node and its children curve nodes.

Parameters:
pValue  Array containing all the function curve default values. This array must contain as many elements as the number of function curves included in the current node and its children curve nodes.
Returns:
Value of parameter pValue added with an offset equal to the number of function curves set times sizeof(double).

void Delete ( KTime  pStart = KTIME_MINUS_INFINITE,
KTime  pStop = KTIME_INFINITE  
)

Delete all the keys found within a given time range.

Delete all the keys found within a given time range in the function curves included in the current node and its children curve nodes.

Parameters:
pStart  Beginning of time range.
pStop  End of time range.

void Replace ( HKFCurveNode  pSource,
KTime  pStart = KTIME_MINUS_INFINITE,
KTime  pStop = KTIME_INFINITE,
bool  pUseGivenSpan = false,
bool  pKeyStartEndOnNoKey = true,
KTime  pTimeSpanOffset = KTIME_ZERO  
)

Replace all the keys found within a given time range.

Replace all the keys found within a given time range in the function curves included in the current node and its children curve nodes.

Parameters:
pSource  Source node tree containing the replacement keys. The curve node tree below pSource must be identical to the curve node tree below the current node.
pStart  Beginning of time range.
pStop  End of time range.
pUseGivenSpan  false = original behavior where the time of the first and last key was used
pKeyStartEndOnNoKey  Inserts a key at the beginning and at the end of the range if there is no key to insert.
pTimeSpanOffset 
KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode
KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode KFCurveNode